/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ah;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.security.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Ch12211
 */
public class Ah {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, FileNotFoundException, IOException {
        URL website = new URL("http://eu.battle.net/auction-data/95a700258b15259bc865cdf2c51bdfed/auctions.json");
        ReadableByteChannel rbc = Channels.newChannel(website.openStream());
        
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmm");
        String uhrzeit = sdf.format(new Date());
        
        FileOutputStream fos = new FileOutputStream("auctions "+ uhrzeit + ".json");
        fos.getChannel().transferFrom(rbc, 0, 1 << 24);
        
    }
    
}
